Skip to content

Commit

Permalink
Merge pull request #969 from lucasponce/chore_bump_ocm_api_0_0_380
Browse files Browse the repository at this point in the history
chore: bump to ocm-api-model 0.0.380
  • Loading branch information
lucasponce authored Jul 5, 2024
2 parents 434c622 + f96ca20 commit fe63da7
Show file tree
Hide file tree
Showing 21 changed files with 4,679 additions and 3,326 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export PATH := $(LOCAL_BIN_PATH):$(PATH)
export CGO_ENABLED=0

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

# Details of the metamodel to use:
Expand Down
28 changes: 20 additions & 8 deletions clustersmgmt/v1/machine_type_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type MachineTypeBuilder struct {
id string
href string
cpu *ValueBuilder
architecture ProcessorType
category MachineTypeCategory
cloudProvider *CloudProviderBuilder
genericName string
Expand Down Expand Up @@ -103,12 +104,21 @@ func (b *MachineTypeBuilder) CPU(value *ValueBuilder) *MachineTypeBuilder {
return b
}

// Architecture sets the value of the 'architecture' attribute to the given value.
//
// Processor type category.
func (b *MachineTypeBuilder) Architecture(value ProcessorType) *MachineTypeBuilder {
b.architecture = value
b.bitmap_ |= 32
return b
}

// Category sets the value of the 'category' attribute to the given value.
//
// Machine type category.
func (b *MachineTypeBuilder) Category(value MachineTypeCategory) *MachineTypeBuilder {
b.category = value
b.bitmap_ |= 32
b.bitmap_ |= 64
return b
}

Expand All @@ -118,17 +128,17 @@ func (b *MachineTypeBuilder) Category(value MachineTypeCategory) *MachineTypeBui
func (b *MachineTypeBuilder) CloudProvider(value *CloudProviderBuilder) *MachineTypeBuilder {
b.cloudProvider = value
if value != nil {
b.bitmap_ |= 64
b.bitmap_ |= 128
} else {
b.bitmap_ &^= 64
b.bitmap_ &^= 128
}
return b
}

// GenericName sets the value of the 'generic_name' attribute to the given value.
func (b *MachineTypeBuilder) GenericName(value string) *MachineTypeBuilder {
b.genericName = value
b.bitmap_ |= 128
b.bitmap_ |= 256
return b
}

Expand All @@ -155,17 +165,17 @@ func (b *MachineTypeBuilder) GenericName(value string) *MachineTypeBuilder {
func (b *MachineTypeBuilder) Memory(value *ValueBuilder) *MachineTypeBuilder {
b.memory = value
if value != nil {
b.bitmap_ |= 256
b.bitmap_ |= 512
} else {
b.bitmap_ &^= 256
b.bitmap_ &^= 512
}
return b
}

// Name sets the value of the 'name' attribute to the given value.
func (b *MachineTypeBuilder) Name(value string) *MachineTypeBuilder {
b.name = value
b.bitmap_ |= 512
b.bitmap_ |= 1024
return b
}

Expand All @@ -174,7 +184,7 @@ func (b *MachineTypeBuilder) Name(value string) *MachineTypeBuilder {
// Machine type size.
func (b *MachineTypeBuilder) Size(value MachineTypeSize) *MachineTypeBuilder {
b.size = value
b.bitmap_ |= 1024
b.bitmap_ |= 2048
return b
}

Expand All @@ -192,6 +202,7 @@ func (b *MachineTypeBuilder) Copy(object *MachineType) *MachineTypeBuilder {
} else {
b.cpu = nil
}
b.architecture = object.architecture
b.category = object.category
if object.cloudProvider != nil {
b.cloudProvider = NewCloudProvider().Copy(object.cloudProvider)
Expand Down Expand Up @@ -222,6 +233,7 @@ func (b *MachineTypeBuilder) Build() (object *MachineType, err error) {
return
}
}
object.architecture = b.architecture
object.category = b.category
if b.cloudProvider != nil {
object.cloudProvider, err = b.cloudProvider.Build()
Expand Down
48 changes: 36 additions & 12 deletions clustersmgmt/v1/machine_type_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type MachineType struct {
id string
href string
cpu *Value
architecture ProcessorType
category MachineTypeCategory
cloudProvider *CloudProvider
genericName string
Expand Down Expand Up @@ -151,12 +152,35 @@ func (o *MachineType) GetCPU() (value *Value, ok bool) {
return
}

// Architecture returns the value of the 'architecture' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// The architecture of the machine type.
func (o *MachineType) Architecture() ProcessorType {
if o != nil && o.bitmap_&32 != 0 {
return o.architecture
}
return ProcessorType("")
}

// GetArchitecture returns the value of the 'architecture' attribute and
// a flag indicating if the attribute has a value.
//
// The architecture of the machine type.
func (o *MachineType) GetArchitecture() (value ProcessorType, ok bool) {
ok = o != nil && o.bitmap_&32 != 0
if ok {
value = o.architecture
}
return
}

// Category returns the value of the 'category' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// The category which the machine type is suitable for.
func (o *MachineType) Category() MachineTypeCategory {
if o != nil && o.bitmap_&32 != 0 {
if o != nil && o.bitmap_&64 != 0 {
return o.category
}
return MachineTypeCategory("")
Expand All @@ -167,7 +191,7 @@ func (o *MachineType) Category() MachineTypeCategory {
//
// The category which the machine type is suitable for.
func (o *MachineType) GetCategory() (value MachineTypeCategory, ok bool) {
ok = o != nil && o.bitmap_&32 != 0
ok = o != nil && o.bitmap_&64 != 0
if ok {
value = o.category
}
Expand All @@ -179,7 +203,7 @@ func (o *MachineType) GetCategory() (value MachineTypeCategory, ok bool) {
//
// Link to the cloud provider that the machine type belongs to.
func (o *MachineType) CloudProvider() *CloudProvider {
if o != nil && o.bitmap_&64 != 0 {
if o != nil && o.bitmap_&128 != 0 {
return o.cloudProvider
}
return nil
Expand All @@ -190,7 +214,7 @@ func (o *MachineType) CloudProvider() *CloudProvider {
//
// Link to the cloud provider that the machine type belongs to.
func (o *MachineType) GetCloudProvider() (value *CloudProvider, ok bool) {
ok = o != nil && o.bitmap_&64 != 0
ok = o != nil && o.bitmap_&128 != 0
if ok {
value = o.cloudProvider
}
Expand All @@ -205,7 +229,7 @@ func (o *MachineType) GetCloudProvider() (value *CloudProvider, ok bool) {
// machine types on different providers.
// Corresponds to `resource_name` values in "compute.node" quota cost data.
func (o *MachineType) GenericName() string {
if o != nil && o.bitmap_&128 != 0 {
if o != nil && o.bitmap_&256 != 0 {
return o.genericName
}
return ""
Expand All @@ -219,7 +243,7 @@ func (o *MachineType) GenericName() string {
// machine types on different providers.
// Corresponds to `resource_name` values in "compute.node" quota cost data.
func (o *MachineType) GetGenericName() (value string, ok bool) {
ok = o != nil && o.bitmap_&128 != 0
ok = o != nil && o.bitmap_&256 != 0
if ok {
value = o.genericName
}
Expand All @@ -231,7 +255,7 @@ func (o *MachineType) GetGenericName() (value string, ok bool) {
//
// The amount of memory of the machine type.
func (o *MachineType) Memory() *Value {
if o != nil && o.bitmap_&256 != 0 {
if o != nil && o.bitmap_&512 != 0 {
return o.memory
}
return nil
Expand All @@ -242,7 +266,7 @@ func (o *MachineType) Memory() *Value {
//
// The amount of memory of the machine type.
func (o *MachineType) GetMemory() (value *Value, ok bool) {
ok = o != nil && o.bitmap_&256 != 0
ok = o != nil && o.bitmap_&512 != 0
if ok {
value = o.memory
}
Expand All @@ -254,7 +278,7 @@ func (o *MachineType) GetMemory() (value *Value, ok bool) {
//
// Human friendly identifier of the machine type, for example `r5.xlarge - Memory Optimized`.
func (o *MachineType) Name() string {
if o != nil && o.bitmap_&512 != 0 {
if o != nil && o.bitmap_&1024 != 0 {
return o.name
}
return ""
Expand All @@ -265,7 +289,7 @@ func (o *MachineType) Name() string {
//
// Human friendly identifier of the machine type, for example `r5.xlarge - Memory Optimized`.
func (o *MachineType) GetName() (value string, ok bool) {
ok = o != nil && o.bitmap_&512 != 0
ok = o != nil && o.bitmap_&1024 != 0
if ok {
value = o.name
}
Expand All @@ -277,7 +301,7 @@ func (o *MachineType) GetName() (value string, ok bool) {
//
// The size of the machine type.
func (o *MachineType) Size() MachineTypeSize {
if o != nil && o.bitmap_&1024 != 0 {
if o != nil && o.bitmap_&2048 != 0 {
return o.size
}
return MachineTypeSize("")
Expand All @@ -288,7 +312,7 @@ func (o *MachineType) Size() MachineTypeSize {
//
// The size of the machine type.
func (o *MachineType) GetSize() (value MachineTypeSize, ok bool) {
ok = o != nil && o.bitmap_&1024 != 0
ok = o != nil && o.bitmap_&2048 != 0
if ok {
value = o.size
}
Expand Down
36 changes: 25 additions & 11 deletions clustersmgmt/v1/machine_type_type_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ func writeMachineType(object *MachineType, stream *jsoniter.Stream) {
count++
}
present_ = object.bitmap_&32 != 0
if present_ {
if count > 0 {
stream.WriteMore()
}
stream.WriteObjectField("architecture")
stream.WriteString(string(object.architecture))
count++
}
present_ = object.bitmap_&64 != 0
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -92,7 +101,7 @@ func writeMachineType(object *MachineType, stream *jsoniter.Stream) {
stream.WriteString(string(object.category))
count++
}
present_ = object.bitmap_&64 != 0 && object.cloudProvider != nil
present_ = object.bitmap_&128 != 0 && object.cloudProvider != nil
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -101,7 +110,7 @@ func writeMachineType(object *MachineType, stream *jsoniter.Stream) {
writeCloudProvider(object.cloudProvider, stream)
count++
}
present_ = object.bitmap_&128 != 0
present_ = object.bitmap_&256 != 0
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -110,7 +119,7 @@ func writeMachineType(object *MachineType, stream *jsoniter.Stream) {
stream.WriteString(object.genericName)
count++
}
present_ = object.bitmap_&256 != 0 && object.memory != nil
present_ = object.bitmap_&512 != 0 && object.memory != nil
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -119,7 +128,7 @@ func writeMachineType(object *MachineType, stream *jsoniter.Stream) {
writeValue(object.memory, stream)
count++
}
present_ = object.bitmap_&512 != 0
present_ = object.bitmap_&1024 != 0
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -128,7 +137,7 @@ func writeMachineType(object *MachineType, stream *jsoniter.Stream) {
stream.WriteString(object.name)
count++
}
present_ = object.bitmap_&1024 != 0
present_ = object.bitmap_&2048 != 0
if present_ {
if count > 0 {
stream.WriteMore()
Expand Down Expand Up @@ -179,32 +188,37 @@ func readMachineType(iterator *jsoniter.Iterator) *MachineType {
value := readValue(iterator)
object.cpu = value
object.bitmap_ |= 16
case "architecture":
text := iterator.ReadString()
value := ProcessorType(text)
object.architecture = value
object.bitmap_ |= 32
case "category":
text := iterator.ReadString()
value := MachineTypeCategory(text)
object.category = value
object.bitmap_ |= 32
object.bitmap_ |= 64
case "cloud_provider":
value := readCloudProvider(iterator)
object.cloudProvider = value
object.bitmap_ |= 64
object.bitmap_ |= 128
case "generic_name":
value := iterator.ReadString()
object.genericName = value
object.bitmap_ |= 128
object.bitmap_ |= 256
case "memory":
value := readValue(iterator)
object.memory = value
object.bitmap_ |= 256
object.bitmap_ |= 512
case "name":
value := iterator.ReadString()
object.name = value
object.bitmap_ |= 512
object.bitmap_ |= 1024
case "size":
text := iterator.ReadString()
value := MachineTypeSize(text)
object.size = value
object.bitmap_ |= 1024
object.bitmap_ |= 2048
default:
iterator.ReadAny()
}
Expand Down
Loading

0 comments on commit fe63da7

Please sign in to comment.