Skip to content

Commit

Permalink
fix(Catalog Management): add metadata and lastoperation to offering i…
Browse files Browse the repository at this point in the history
…nstance (#126)
  • Loading branch information
JonWoodlief committed Jun 9, 2021
1 parent 41eab61 commit 097f824
Show file tree
Hide file tree
Showing 3 changed files with 279 additions and 6 deletions.
107 changes: 107 additions & 0 deletions catalogmanagementv1/catalog_management_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -4683,6 +4683,12 @@ func (catalogManagement *CatalogManagementV1) CreateOfferingInstanceWithContext(
if createOfferingInstanceOptions.Channel != nil {
body["channel"] = createOfferingInstanceOptions.Channel
}
if createOfferingInstanceOptions.Metadata != nil {
body["metadata"] = createOfferingInstanceOptions.Metadata
}
if createOfferingInstanceOptions.LastOperation != nil {
body["last_operation"] = createOfferingInstanceOptions.LastOperation
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
return
Expand Down Expand Up @@ -4864,6 +4870,12 @@ func (catalogManagement *CatalogManagementV1) PutOfferingInstanceWithContext(ctx
if putOfferingInstanceOptions.Channel != nil {
body["channel"] = putOfferingInstanceOptions.Channel
}
if putOfferingInstanceOptions.Metadata != nil {
body["metadata"] = putOfferingInstanceOptions.Metadata
}
if putOfferingInstanceOptions.LastOperation != nil {
body["last_operation"] = putOfferingInstanceOptions.LastOperation
}
_, err = builder.SetBodyContentJSON(body)
if err != nil {
return
Expand Down Expand Up @@ -6250,6 +6262,12 @@ type CreateOfferingInstanceOptions struct {
// Channel to pin the operator subscription to.
Channel *string

// Map of metadata values for this offering instance.
Metadata map[string]interface{}

// the last operation performed and status.
LastOperation *OfferingInstanceLastOperation

// Allows users to set headers on API requests
Headers map[string]string
}
Expand Down Expand Up @@ -6369,6 +6387,18 @@ func (options *CreateOfferingInstanceOptions) SetChannel(channel string) *Create
return options
}

// SetMetadata : Allow user to set Metadata
func (options *CreateOfferingInstanceOptions) SetMetadata(metadata map[string]interface{}) *CreateOfferingInstanceOptions {
options.Metadata = metadata
return options
}

// SetLastOperation : Allow user to set LastOperation
func (options *CreateOfferingInstanceOptions) SetLastOperation(lastOperation *OfferingInstanceLastOperation) *CreateOfferingInstanceOptions {
options.LastOperation = lastOperation
return options
}

// SetHeaders : Allow user to set Headers
func (options *CreateOfferingInstanceOptions) SetHeaders(param map[string]string) *CreateOfferingInstanceOptions {
options.Headers = param
Expand Down Expand Up @@ -9919,6 +9949,12 @@ type OfferingInstance struct {

// Channel to pin the operator subscription to.
Channel *string `json:"channel,omitempty"`

// Map of metadata values for this offering instance.
Metadata map[string]interface{} `json:"metadata,omitempty"`

// the last operation performed and status.
LastOperation *OfferingInstanceLastOperation `json:"last_operation,omitempty"`
}

// UnmarshalOfferingInstance unmarshals an instance of OfferingInstance from the specified map of raw messages.
Expand Down Expand Up @@ -9992,6 +10028,59 @@ func UnmarshalOfferingInstance(m map[string]json.RawMessage, result interface{})
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata)
if err != nil {
return
}
err = core.UnmarshalModel(m, "last_operation", &obj.LastOperation, UnmarshalOfferingInstanceLastOperation)
if err != nil {
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}

// OfferingInstanceLastOperation : the last operation performed and status.
type OfferingInstanceLastOperation struct {
// last operation performed.
Operation *string `json:"operation,omitempty"`

// state after the last operation performed.
State *string `json:"state,omitempty"`

// additional information about the last operation.
Message *string `json:"message,omitempty"`

// transaction id from the last operation.
TransactionID *string `json:"transaction_id,omitempty"`

// Date and time last updated.
Updated *string `json:"updated,omitempty"`
}

// UnmarshalOfferingInstanceLastOperation unmarshals an instance of OfferingInstanceLastOperation from the specified map of raw messages.
func UnmarshalOfferingInstanceLastOperation(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(OfferingInstanceLastOperation)
err = core.UnmarshalPrimitive(m, "operation", &obj.Operation)
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "state", &obj.State)
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "message", &obj.Message)
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "transaction_id", &obj.TransactionID)
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "updated", &obj.Updated)
if err != nil {
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
Expand Down Expand Up @@ -10558,6 +10647,12 @@ type PutOfferingInstanceOptions struct {
// Channel to pin the operator subscription to.
Channel *string

// Map of metadata values for this offering instance.
Metadata map[string]interface{}

// the last operation performed and status.
LastOperation *OfferingInstanceLastOperation

// Allows users to set headers on API requests
Headers map[string]string
}
Expand Down Expand Up @@ -10684,6 +10779,18 @@ func (options *PutOfferingInstanceOptions) SetChannel(channel string) *PutOfferi
return options
}

// SetMetadata : Allow user to set Metadata
func (options *PutOfferingInstanceOptions) SetMetadata(metadata map[string]interface{}) *PutOfferingInstanceOptions {
options.Metadata = metadata
return options
}

// SetLastOperation : Allow user to set LastOperation
func (options *PutOfferingInstanceOptions) SetLastOperation(lastOperation *OfferingInstanceLastOperation) *PutOfferingInstanceOptions {
options.LastOperation = lastOperation
return options
}

// SetHeaders : Allow user to set Headers
func (options *PutOfferingInstanceOptions) SetHeaders(param map[string]string) *PutOfferingInstanceOptions {
options.Headers = param
Expand Down
2 changes: 2 additions & 0 deletions catalogmanagementv1/catalog_management_v1_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2098,6 +2098,7 @@ var _ = Describe(`CatalogManagementV1 Integration Tests (New)`, func() {
Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(202))
Expect(offeringInstance).ToNot(BeNil())
Expect(*offeringInstance.LastOperation.State).To(Equal("in progress"))
fmt.Fprintf(GinkgoWriter, "CreateOfferingInstance() result:\n%s\n", common.ToJSON(offeringInstance))

Expect(offeringInstance.ID).ToNot(BeNil())
Expand All @@ -2119,6 +2120,7 @@ var _ = Describe(`CatalogManagementV1 Integration Tests (New)`, func() {

offeringInstance, response, err := catalogManagementService.GetOfferingInstance(getOfferingInstanceOptions)

Expect(offeringInstance.Metadata).ToNot(BeNil())
Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(200))
Expect(offeringInstance).ToNot(BeNil())
Expand Down

0 comments on commit 097f824

Please sign in to comment.