Skip to content

Commit

Permalink
Merge pull request #903 from Ankit152/clusters-mgmt-changes
Browse files Browse the repository at this point in the history
feat: adding support for package_image in clusters_mgmt
  • Loading branch information
ciaranRoche authored Feb 9, 2024
2 parents 35483fd + c19a020 commit d18ef86
Show file tree
Hide file tree
Showing 6 changed files with 7,645 additions and 7,585 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.352
model_version:=v0.0.353
model_url:=https://github.com/openshift-online/ocm-api-model.git

# Details of the metamodel to use:
Expand Down
20 changes: 15 additions & 5 deletions clustersmgmt/v1/add_on_version_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type AddOnVersionBuilder struct {
availableUpgrades []string
channel string
config *AddOnConfigBuilder
packageImage string
parameters *AddOnParameterListBuilder
pullSecretName string
requirements []*AddOnRequirementBuilder
Expand Down Expand Up @@ -112,40 +113,47 @@ func (b *AddOnVersionBuilder) Enabled(value bool) *AddOnVersionBuilder {
return b
}

// PackageImage sets the value of the 'package_image' attribute to the given value.
func (b *AddOnVersionBuilder) PackageImage(value string) *AddOnVersionBuilder {
b.packageImage = value
b.bitmap_ |= 256
return b
}

// Parameters sets the value of the 'parameters' attribute to the given values.
func (b *AddOnVersionBuilder) Parameters(value *AddOnParameterListBuilder) *AddOnVersionBuilder {
b.parameters = value
b.bitmap_ |= 256
b.bitmap_ |= 512
return b
}

// PullSecretName sets the value of the 'pull_secret_name' attribute to the given value.
func (b *AddOnVersionBuilder) PullSecretName(value string) *AddOnVersionBuilder {
b.pullSecretName = value
b.bitmap_ |= 512
b.bitmap_ |= 1024
return b
}

// Requirements sets the value of the 'requirements' attribute to the given values.
func (b *AddOnVersionBuilder) Requirements(values ...*AddOnRequirementBuilder) *AddOnVersionBuilder {
b.requirements = make([]*AddOnRequirementBuilder, len(values))
copy(b.requirements, values)
b.bitmap_ |= 1024
b.bitmap_ |= 2048
return b
}

// SourceImage sets the value of the 'source_image' attribute to the given value.
func (b *AddOnVersionBuilder) SourceImage(value string) *AddOnVersionBuilder {
b.sourceImage = value
b.bitmap_ |= 2048
b.bitmap_ |= 4096
return b
}

// SubOperators sets the value of the 'sub_operators' attribute to the given values.
func (b *AddOnVersionBuilder) SubOperators(values ...*AddOnSubOperatorBuilder) *AddOnVersionBuilder {
b.subOperators = make([]*AddOnSubOperatorBuilder, len(values))
copy(b.subOperators, values)
b.bitmap_ |= 4096
b.bitmap_ |= 8192
return b
}

Expand Down Expand Up @@ -178,6 +186,7 @@ func (b *AddOnVersionBuilder) Copy(object *AddOnVersion) *AddOnVersionBuilder {
b.config = nil
}
b.enabled = object.enabled
b.packageImage = object.packageImage
if object.parameters != nil {
b.parameters = NewAddOnParameterList().Copy(object.parameters)
} else {
Expand Down Expand Up @@ -231,6 +240,7 @@ func (b *AddOnVersionBuilder) Build() (object *AddOnVersion, err error) {
}
}
object.enabled = b.enabled
object.packageImage = b.packageImage
if b.parameters != nil {
object.parameters, err = b.parameters.Build()
if err != nil {
Expand Down
44 changes: 34 additions & 10 deletions clustersmgmt/v1/add_on_version_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type AddOnVersion struct {
availableUpgrades []string
channel string
config *AddOnConfig
packageImage string
parameters *AddOnParameterList
pullSecretName string
requirements []*AddOnRequirement
Expand Down Expand Up @@ -222,12 +223,35 @@ func (o *AddOnVersion) GetEnabled() (value bool, ok bool) {
return
}

// PackageImage returns the value of the 'package_image' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// The package image for this addon version
func (o *AddOnVersion) PackageImage() string {
if o != nil && o.bitmap_&256 != 0 {
return o.packageImage
}
return ""
}

// GetPackageImage returns the value of the 'package_image' attribute and
// a flag indicating if the attribute has a value.
//
// The package image for this addon version
func (o *AddOnVersion) GetPackageImage() (value string, ok bool) {
ok = o != nil && o.bitmap_&256 != 0
if ok {
value = o.packageImage
}
return
}

// Parameters returns the value of the 'parameters' attribute, or
// the zero value of the type if the attribute doesn't have a value.
//
// List of parameters for this add-on version.
func (o *AddOnVersion) Parameters() *AddOnParameterList {
if o != nil && o.bitmap_&256 != 0 {
if o != nil && o.bitmap_&512 != 0 {
return o.parameters
}
return nil
Expand All @@ -238,7 +262,7 @@ func (o *AddOnVersion) Parameters() *AddOnParameterList {
//
// List of parameters for this add-on version.
func (o *AddOnVersion) GetParameters() (value *AddOnParameterList, ok bool) {
ok = o != nil && o.bitmap_&256 != 0
ok = o != nil && o.bitmap_&512 != 0
if ok {
value = o.parameters
}
Expand All @@ -250,7 +274,7 @@ func (o *AddOnVersion) GetParameters() (value *AddOnParameterList, ok bool) {
//
// The pull secret name used for this addon version.
func (o *AddOnVersion) PullSecretName() string {
if o != nil && o.bitmap_&512 != 0 {
if o != nil && o.bitmap_&1024 != 0 {
return o.pullSecretName
}
return ""
Expand All @@ -261,7 +285,7 @@ func (o *AddOnVersion) PullSecretName() string {
//
// The pull secret name used for this addon version.
func (o *AddOnVersion) GetPullSecretName() (value string, ok bool) {
ok = o != nil && o.bitmap_&512 != 0
ok = o != nil && o.bitmap_&1024 != 0
if ok {
value = o.pullSecretName
}
Expand All @@ -273,7 +297,7 @@ func (o *AddOnVersion) GetPullSecretName() (value string, ok bool) {
//
// List of requirements for this add-on version.
func (o *AddOnVersion) Requirements() []*AddOnRequirement {
if o != nil && o.bitmap_&1024 != 0 {
if o != nil && o.bitmap_&2048 != 0 {
return o.requirements
}
return nil
Expand All @@ -284,7 +308,7 @@ func (o *AddOnVersion) Requirements() []*AddOnRequirement {
//
// List of requirements for this add-on version.
func (o *AddOnVersion) GetRequirements() (value []*AddOnRequirement, ok bool) {
ok = o != nil && o.bitmap_&1024 != 0
ok = o != nil && o.bitmap_&2048 != 0
if ok {
value = o.requirements
}
Expand All @@ -296,7 +320,7 @@ func (o *AddOnVersion) GetRequirements() (value []*AddOnRequirement, ok bool) {
//
// The catalog source image for this add-on version.
func (o *AddOnVersion) SourceImage() string {
if o != nil && o.bitmap_&2048 != 0 {
if o != nil && o.bitmap_&4096 != 0 {
return o.sourceImage
}
return ""
Expand All @@ -307,7 +331,7 @@ func (o *AddOnVersion) SourceImage() string {
//
// The catalog source image for this add-on version.
func (o *AddOnVersion) GetSourceImage() (value string, ok bool) {
ok = o != nil && o.bitmap_&2048 != 0
ok = o != nil && o.bitmap_&4096 != 0
if ok {
value = o.sourceImage
}
Expand All @@ -319,7 +343,7 @@ func (o *AddOnVersion) GetSourceImage() (value string, ok bool) {
//
// List of sub operators for this add-on version.
func (o *AddOnVersion) SubOperators() []*AddOnSubOperator {
if o != nil && o.bitmap_&4096 != 0 {
if o != nil && o.bitmap_&8192 != 0 {
return o.subOperators
}
return nil
Expand All @@ -330,7 +354,7 @@ func (o *AddOnVersion) SubOperators() []*AddOnSubOperator {
//
// List of sub operators for this add-on version.
func (o *AddOnVersion) GetSubOperators() (value []*AddOnSubOperator, ok bool) {
ok = o != nil && o.bitmap_&4096 != 0
ok = o != nil && o.bitmap_&8192 != 0
if ok {
value = o.subOperators
}
Expand Down
33 changes: 23 additions & 10 deletions clustersmgmt/v1/add_on_version_type_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,16 @@ func writeAddOnVersion(object *AddOnVersion, stream *jsoniter.Stream) {
stream.WriteBool(object.enabled)
count++
}
present_ = object.bitmap_&256 != 0 && object.parameters != nil
present_ = object.bitmap_&256 != 0
if present_ {
if count > 0 {
stream.WriteMore()
}
stream.WriteObjectField("package_image")
stream.WriteString(object.packageImage)
count++
}
present_ = object.bitmap_&512 != 0 && object.parameters != nil
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -122,7 +131,7 @@ func writeAddOnVersion(object *AddOnVersion, stream *jsoniter.Stream) {
stream.WriteObjectEnd()
count++
}
present_ = object.bitmap_&512 != 0
present_ = object.bitmap_&1024 != 0
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -131,7 +140,7 @@ func writeAddOnVersion(object *AddOnVersion, stream *jsoniter.Stream) {
stream.WriteString(object.pullSecretName)
count++
}
present_ = object.bitmap_&1024 != 0 && object.requirements != nil
present_ = object.bitmap_&2048 != 0 && object.requirements != nil
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -140,7 +149,7 @@ func writeAddOnVersion(object *AddOnVersion, stream *jsoniter.Stream) {
writeAddOnRequirementList(object.requirements, stream)
count++
}
present_ = object.bitmap_&2048 != 0
present_ = object.bitmap_&4096 != 0
if present_ {
if count > 0 {
stream.WriteMore()
Expand All @@ -149,7 +158,7 @@ func writeAddOnVersion(object *AddOnVersion, stream *jsoniter.Stream) {
stream.WriteString(object.sourceImage)
count++
}
present_ = object.bitmap_&4096 != 0 && object.subOperators != nil
present_ = object.bitmap_&8192 != 0 && object.subOperators != nil
if present_ {
if count > 0 {
stream.WriteMore()
Expand Down Expand Up @@ -212,6 +221,10 @@ func readAddOnVersion(iterator *jsoniter.Iterator) *AddOnVersion {
value := iterator.ReadBool()
object.enabled = value
object.bitmap_ |= 128
case "package_image":
value := iterator.ReadString()
object.packageImage = value
object.bitmap_ |= 256
case "parameters":
value := &AddOnParameterList{}
for {
Expand All @@ -232,23 +245,23 @@ func readAddOnVersion(iterator *jsoniter.Iterator) *AddOnVersion {
}
}
object.parameters = value
object.bitmap_ |= 256
object.bitmap_ |= 512
case "pull_secret_name":
value := iterator.ReadString()
object.pullSecretName = value
object.bitmap_ |= 512
object.bitmap_ |= 1024
case "requirements":
value := readAddOnRequirementList(iterator)
object.requirements = value
object.bitmap_ |= 1024
object.bitmap_ |= 2048
case "source_image":
value := iterator.ReadString()
object.sourceImage = value
object.bitmap_ |= 2048
object.bitmap_ |= 4096
case "sub_operators":
value := readAddOnSubOperatorList(iterator)
object.subOperators = value
object.bitmap_ |= 4096
object.bitmap_ |= 8192
default:
iterator.ReadAny()
}
Expand Down
Loading

0 comments on commit d18ef86

Please sign in to comment.