Skip to content

Commit

Permalink
Merge pull request #592 from renan-campos/v0.1.252
Browse files Browse the repository at this point in the history
Update to model 0.0.183
  • Loading branch information
jhernand authored Mar 17, 2022
2 parents 89753f2 + 769f6da commit e89d616
Show file tree
Hide file tree
Showing 8 changed files with 279 additions and 192 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
This document describes the relevant changes between releases of the OCM API
SDK.

## 0.1.252 Mar 17 2022

- Update to model 0.1.183:
- Added field for parameters to be specified for managed services.

## 0.1.251 Mar 15 2022

- Update to model 0.1.182:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
export CGO_ENABLED=0

# Details of the model to use:
model_version:=v0.0.182
model_version:=v0.0.183
model_url:=https://github.com/openshift-online/ocm-api-model.git

# Details of the metamodel to use:
Expand Down
6 changes: 6 additions & 0 deletions openapi/service_mgmt/v1/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,12 @@
"type": "string",
"format": "date-time"
},
"parameters": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ServiceParameter"
}
},
"resources": {
"type": "array",
"items": {
Expand Down
36 changes: 32 additions & 4 deletions servicemgmt/v1/managed_service_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type ManagedServiceBuilder struct {
addon *StatefulObjectBuilder
cluster *ClusterBuilder
createdAt time.Time
parameters []*ServiceParameterBuilder
resources []*StatefulObjectBuilder
service string
serviceState string
Expand Down Expand Up @@ -104,13 +105,23 @@ func (b *ManagedServiceBuilder) CreatedAt(value time.Time) *ManagedServiceBuilde
return b
}

// Parameters sets the value of the 'parameters' attribute to the given values.
//
//
func (b *ManagedServiceBuilder) Parameters(values ...*ServiceParameterBuilder) *ManagedServiceBuilder {
b.parameters = make([]*ServiceParameterBuilder, len(values))
copy(b.parameters, values)
b.bitmap_ |= 64
return b
}

// Resources sets the value of the 'resources' attribute to the given values.
//
//
func (b *ManagedServiceBuilder) Resources(values ...*StatefulObjectBuilder) *ManagedServiceBuilder {
b.resources = make([]*StatefulObjectBuilder, len(values))
copy(b.resources, values)
b.bitmap_ |= 64
b.bitmap_ |= 128
return b
}

Expand All @@ -119,7 +130,7 @@ func (b *ManagedServiceBuilder) Resources(values ...*StatefulObjectBuilder) *Man
//
func (b *ManagedServiceBuilder) Service(value string) *ManagedServiceBuilder {
b.service = value
b.bitmap_ |= 128
b.bitmap_ |= 256
return b
}

Expand All @@ -128,7 +139,7 @@ func (b *ManagedServiceBuilder) Service(value string) *ManagedServiceBuilder {
//
func (b *ManagedServiceBuilder) ServiceState(value string) *ManagedServiceBuilder {
b.serviceState = value
b.bitmap_ |= 256
b.bitmap_ |= 512
return b
}

Expand All @@ -137,7 +148,7 @@ func (b *ManagedServiceBuilder) ServiceState(value string) *ManagedServiceBuilde
//
func (b *ManagedServiceBuilder) UpdatedAt(value time.Time) *ManagedServiceBuilder {
b.updatedAt = value
b.bitmap_ |= 512
b.bitmap_ |= 1024
return b
}

Expand All @@ -160,6 +171,14 @@ func (b *ManagedServiceBuilder) Copy(object *ManagedService) *ManagedServiceBuil
b.cluster = nil
}
b.createdAt = object.createdAt
if object.parameters != nil {
b.parameters = make([]*ServiceParameterBuilder, len(object.parameters))
for i, v := range object.parameters {
b.parameters[i] = NewServiceParameter().Copy(v)
}
} else {
b.parameters = nil
}
if object.resources != nil {
b.resources = make([]*StatefulObjectBuilder, len(object.resources))
for i, v := range object.resources {
Expand Down Expand Up @@ -193,6 +212,15 @@ func (b *ManagedServiceBuilder) Build() (object *ManagedService, err error) {
}
}
object.createdAt = b.createdAt
if b.parameters != nil {
object.parameters = make([]*ServiceParameter, len(b.parameters))
for i, v := range b.parameters {
object.parameters[i], err = v.Build()
if err != nil {
return
}
}
}
if b.resources != nil {
object.resources = make([]*StatefulObject, len(b.resources))
for i, v := range b.resources {
Expand Down
40 changes: 32 additions & 8 deletions servicemgmt/v1/managed_service_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type ManagedService struct {
addon *StatefulObject
cluster *Cluster
createdAt time.Time
parameters []*ServiceParameter
resources []*StatefulObject
service string
serviceState string
Expand Down Expand Up @@ -177,12 +178,35 @@ func (o *ManagedService) GetCreatedAt() (value time.Time, ok bool) {
return
}

// Parameters returns the value of the 'parameters' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
//
func (o *ManagedService) Parameters() []*ServiceParameter {
if o != nil && o.bitmap_&64 != 0 {
return o.parameters
}
return nil
}

// GetParameters returns the value of the 'parameters' attribute and
// a flag indicating if the attribute has a value.
//
//
func (o *ManagedService) GetParameters() (value []*ServiceParameter, ok bool) {
ok = o != nil && o.bitmap_&64 != 0
if ok {
value = o.parameters
}
return
}

// Resources returns the value of the 'resources' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
//
func (o *ManagedService) Resources() []*StatefulObject {
if o != nil && o.bitmap_&64 != 0 {
if o != nil && o.bitmap_&128 != 0 {
return o.resources
}
return nil
Expand All @@ -193,7 +217,7 @@ func (o *ManagedService) Resources() []*StatefulObject {
//
//
func (o *ManagedService) GetResources() (value []*StatefulObject, ok bool) {
ok = o != nil && o.bitmap_&64 != 0
ok = o != nil && o.bitmap_&128 != 0
if ok {
value = o.resources
}
Expand All @@ -205,7 +229,7 @@ func (o *ManagedService) GetResources() (value []*StatefulObject, ok bool) {
//
//
func (o *ManagedService) Service() string {
if o != nil && o.bitmap_&128 != 0 {
if o != nil && o.bitmap_&256 != 0 {
return o.service
}
return ""
Expand All @@ -216,7 +240,7 @@ func (o *ManagedService) Service() string {
//
//
func (o *ManagedService) GetService() (value string, ok bool) {
ok = o != nil && o.bitmap_&128 != 0
ok = o != nil && o.bitmap_&256 != 0
if ok {
value = o.service
}
Expand All @@ -228,7 +252,7 @@ func (o *ManagedService) GetService() (value string, ok bool) {
//
//
func (o *ManagedService) ServiceState() string {
if o != nil && o.bitmap_&256 != 0 {
if o != nil && o.bitmap_&512 != 0 {
return o.serviceState
}
return ""
Expand All @@ -239,7 +263,7 @@ func (o *ManagedService) ServiceState() string {
//
//
func (o *ManagedService) GetServiceState() (value string, ok bool) {
ok = o != nil && o.bitmap_&256 != 0
ok = o != nil && o.bitmap_&512 != 0
if ok {
value = o.serviceState
}
Expand All @@ -251,7 +275,7 @@ func (o *ManagedService) GetServiceState() (value string, ok bool) {
//
//
func (o *ManagedService) UpdatedAt() time.Time {
if o != nil && o.bitmap_&512 != 0 {
if o != nil && o.bitmap_&1024 != 0 {
return o.updatedAt
}
return time.Time{}
Expand All @@ -262,7 +286,7 @@ func (o *ManagedService) UpdatedAt() time.Time {
//
//
func (o *ManagedService) GetUpdatedAt() (value time.Time, ok bool) {
ok = o != nil && o.bitmap_&512 != 0
ok = o != nil && o.bitmap_&1024 != 0
if ok {
value = o.updatedAt
}
Expand Down
29 changes: 21 additions & 8 deletions servicemgmt/v1/managed_service_type_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,16 @@ func writeManagedService(object *ManagedService, stream *jsoniter.Stream) {
stream.WriteString((object.createdAt).Format(time.RFC3339))
count++
}
present_ = object.bitmap_&64 != 0 && object.resources != nil
present_ = object.bitmap_&64 != 0 && object.parameters != nil
if present_ {
if count > 0 {
stream.WriteMore()
}
stream.WriteObjectField("parameters")
writeServiceParameterList(object.parameters, stream)
count++
}
present_ = object.bitmap_&128 != 0 && object.resources != nil
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -102,7 +111,7 @@ func writeManagedService(object *ManagedService, stream *jsoniter.Stream) {
writeStatefulObjectList(object.resources, stream)
count++
}
present_ = object.bitmap_&128 != 0
present_ = object.bitmap_&256 != 0
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -111,7 +120,7 @@ func writeManagedService(object *ManagedService, stream *jsoniter.Stream) {
stream.WriteString(object.service)
count++
}
present_ = object.bitmap_&256 != 0
present_ = object.bitmap_&512 != 0
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -120,7 +129,7 @@ func writeManagedService(object *ManagedService, stream *jsoniter.Stream) {
stream.WriteString(object.serviceState)
count++
}
present_ = object.bitmap_&512 != 0
present_ = object.bitmap_&1024 != 0
if present_ {
if count > 0 {
stream.WriteMore()
Expand Down Expand Up @@ -179,26 +188,30 @@ func readManagedService(iterator *jsoniter.Iterator) *ManagedService {
}
object.createdAt = value
object.bitmap_ |= 32
case "parameters":
value := readServiceParameterList(iterator)
object.parameters = value
object.bitmap_ |= 64
case "resources":
value := readStatefulObjectList(iterator)
object.resources = value
object.bitmap_ |= 64
object.bitmap_ |= 128
case "service":
value := iterator.ReadString()
object.service = value
object.bitmap_ |= 128
object.bitmap_ |= 256
case "service_state":
value := iterator.ReadString()
object.serviceState = value
object.bitmap_ |= 256
object.bitmap_ |= 512
case "updated_at":
text := iterator.ReadString()
value, err := time.Parse(time.RFC3339, text)
if err != nil {
iterator.ReportError("", err.Error())
}
object.updatedAt = value
object.bitmap_ |= 512
object.bitmap_ |= 1024
default:
iterator.ReadAny()
}
Expand Down
Loading

0 comments on commit e89d616

Please sign in to comment.