Skip to content

Commit

Permalink
Rewrite Resource functions (#10228)
Browse files Browse the repository at this point in the history
  • Loading branch information
zli82016 authored Mar 19, 2024
1 parent d58db7c commit 5fddaec
Show file tree
Hide file tree
Showing 9 changed files with 629 additions and 115 deletions.
8 changes: 4 additions & 4 deletions mmv1/api/async.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Async struct {
google.YamlValidator

// Describes an operation
Operation Operation
Operation *Operation

// The list of methods where operations are used.
Actions []string
Expand All @@ -50,7 +50,7 @@ type Operation struct {
// Contains information about an long-running operation, to make
// requests for the state of an operation.

Timeouts Timeouts
Timeouts *Timeouts

Result Result
}
Expand Down Expand Up @@ -79,7 +79,7 @@ type OpAsync struct {
// TODO: Should embed Async or not?
// < Async

Operation OpAsyncOperation
Operation *OpAsyncOperation

Result OpAsyncResult

Expand Down Expand Up @@ -127,7 +127,7 @@ type OpAsyncOperation struct {

WaitMs int `yaml:"wait_ms"`

Timeouts Timeouts
Timeouts *Timeouts

// Use this if the resource includes the full operation url.
FullUrl string `yaml:"full_url"`
Expand Down
20 changes: 10 additions & 10 deletions mmv1/api/product.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type Product struct {

OperationRetry string `yaml:"operation_retry"`

Async OpAsync
Async *OpAsync

LegacyName string `yaml:"legacy_name"`

Expand Down Expand Up @@ -211,21 +211,21 @@ func (p *Product) SetPropertiesBasedOnVersion(version *product.Version) {
p.BaseUrl = version.BaseUrl
}

// // ====================
// // Debugging Methods
// // ====================
// ====================
// Debugging Methods
// ====================

// def to_s
// // relies on the custom to_json definitions
// JSON.pretty_generate(self)
// end

// // Prints a dot notation path to where the field is nested within the parent
// // object when called on a property. eg: parent.meta.label.foo
// // Redefined on Product to terminate the calls up the parent chain.
// def lineage
// name
// end
// Prints a dot notation path to where the field is nested within the parent
// object when called on a property. eg: parent.meta.label.foo
// Redefined on Product to terminate the calls up the parent chain.
func (p Product) Lineage() string {
return p.Name
}

// def to_json(opts = nil)
// json_out = {}
Expand Down
Loading

0 comments on commit 5fddaec

Please sign in to comment.