Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating changes based on API model of addons_mgmt #1003

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions addonsmgmt/v1/addon_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type AddonBuilder struct {
name string
namespaces []*AddonNamespaceBuilder
operatorName string
parameters *AddonParametersBuilder
parameters *AddonParameterListBuilder
requirements []*AddonRequirementBuilder
resourceCost float64
resourceName string
Expand Down Expand Up @@ -212,16 +212,10 @@ func (b *AddonBuilder) OperatorName(value string) *AddonBuilder {
return b
}

// Parameters sets the value of the 'parameters' attribute to the given value.
//
// Representation of AddonParameters
func (b *AddonBuilder) Parameters(value *AddonParametersBuilder) *AddonBuilder {
// Parameters sets the value of the 'parameters' attribute to the given values.
func (b *AddonBuilder) Parameters(value *AddonParameterListBuilder) *AddonBuilder {
b.parameters = value
if value != nil {
b.bitmap_ |= 524288
} else {
b.bitmap_ &^= 524288
}
b.bitmap_ |= 524288
return b
}

Expand Down Expand Up @@ -332,7 +326,7 @@ func (b *AddonBuilder) Copy(object *Addon) *AddonBuilder {
}
b.operatorName = object.operatorName
if object.parameters != nil {
b.parameters = NewAddonParameters().Copy(object.parameters)
b.parameters = NewAddonParameterList().Copy(object.parameters)
} else {
b.parameters = nil
}
Expand Down
16 changes: 5 additions & 11 deletions addonsmgmt/v1/addon_installation_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type AddonInstallationBuilder struct {
deletedTimestamp time.Time
desiredVersion string
operatorVersion string
parameters *AddonInstallationParametersBuilder
parameters *AddonInstallationParameterListBuilder
state AddonInstallationState
stateDescription string
subscription *ObjectReferenceBuilder
Expand Down Expand Up @@ -149,16 +149,10 @@ func (b *AddonInstallationBuilder) OperatorVersion(value string) *AddonInstallat
return b
}

// Parameters sets the value of the 'parameters' attribute to the given value.
//
// representation of addon installation parameter
func (b *AddonInstallationBuilder) Parameters(value *AddonInstallationParametersBuilder) *AddonInstallationBuilder {
// Parameters sets the value of the 'parameters' attribute to the given values.
func (b *AddonInstallationBuilder) Parameters(value *AddonInstallationParameterListBuilder) *AddonInstallationBuilder {
b.parameters = value
if value != nil {
b.bitmap_ |= 2048
} else {
b.bitmap_ &^= 2048
}
b.bitmap_ |= 2048
return b
}

Expand Down Expand Up @@ -227,7 +221,7 @@ func (b *AddonInstallationBuilder) Copy(object *AddonInstallation) *AddonInstall
b.desiredVersion = object.desiredVersion
b.operatorVersion = object.operatorVersion
if object.parameters != nil {
b.parameters = NewAddonInstallationParameters().Copy(object.parameters)
b.parameters = NewAddonInstallationParameterList().Copy(object.parameters)
} else {
b.parameters = nil
}
Expand Down
6 changes: 3 additions & 3 deletions addonsmgmt/v1/addon_installation_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type AddonInstallation struct {
deletedTimestamp time.Time
desiredVersion string
operatorVersion string
parameters *AddonInstallationParameters
parameters *AddonInstallationParameterList
state AddonInstallationState
stateDescription string
subscription *ObjectReference
Expand Down Expand Up @@ -302,7 +302,7 @@ func (o *AddonInstallation) GetOperatorVersion() (value string, ok bool) {
// the zero value of the type if the attribute doesn't have a value.
//
// Parameters in the installation
func (o *AddonInstallation) Parameters() *AddonInstallationParameters {
func (o *AddonInstallation) Parameters() *AddonInstallationParameterList {
if o != nil && o.bitmap_&2048 != 0 {
return o.parameters
}
Expand All @@ -313,7 +313,7 @@ func (o *AddonInstallation) Parameters() *AddonInstallationParameters {
// a flag indicating if the attribute has a value.
//
// Parameters in the installation
func (o *AddonInstallation) GetParameters() (value *AddonInstallationParameters, ok bool) {
func (o *AddonInstallation) GetParameters() (value *AddonInstallationParameterList, ok bool) {
ok = o != nil && o.bitmap_&2048 != 0
if ok {
value = o.parameters
Expand Down
24 changes: 22 additions & 2 deletions addonsmgmt/v1/addon_installation_type_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ func writeAddonInstallation(object *AddonInstallation, stream *jsoniter.Stream)
stream.WriteMore()
}
stream.WriteObjectField("parameters")
writeAddonInstallationParameters(object.parameters, stream)
stream.WriteObjectStart()
stream.WriteObjectField("items")
writeAddonInstallationParameterList(object.parameters.items, stream)
stream.WriteObjectEnd()
count++
}
present_ = object.bitmap_&4096 != 0
Expand Down Expand Up @@ -258,7 +261,24 @@ func readAddonInstallation(iterator *jsoniter.Iterator) *AddonInstallation {
object.operatorVersion = value
object.bitmap_ |= 1024
case "parameters":
value := readAddonInstallationParameters(iterator)
value := &AddonInstallationParameterList{}
for {
field := iterator.ReadObject()
if field == "" {
break
}
switch field {
case "kind":
text := iterator.ReadString()
value.link = text == AddonInstallationParameterListLinkKind
case "href":
value.href = iterator.ReadString()
case "items":
value.items = readAddonInstallationParameterList(iterator)
default:
iterator.ReadAny()
}
}
object.parameters = value
object.bitmap_ |= 2048
case "state":
Expand Down
6 changes: 3 additions & 3 deletions addonsmgmt/v1/addon_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type Addon struct {
name string
namespaces []*AddonNamespace
operatorName string
parameters *AddonParameters
parameters *AddonParameterList
requirements []*AddonRequirement
resourceCost float64
resourceName string
Expand Down Expand Up @@ -492,7 +492,7 @@ func (o *Addon) GetOperatorName() (value string, ok bool) {
// the zero value of the type if the attribute doesn't have a value.
//
// List of parameters for this addon.
func (o *Addon) Parameters() *AddonParameters {
func (o *Addon) Parameters() *AddonParameterList {
if o != nil && o.bitmap_&524288 != 0 {
return o.parameters
}
Expand All @@ -503,7 +503,7 @@ func (o *Addon) Parameters() *AddonParameters {
// a flag indicating if the attribute has a value.
//
// List of parameters for this addon.
func (o *Addon) GetParameters() (value *AddonParameters, ok bool) {
func (o *Addon) GetParameters() (value *AddonParameterList, ok bool) {
ok = o != nil && o.bitmap_&524288 != 0
if ok {
value = o.parameters
Expand Down
24 changes: 22 additions & 2 deletions addonsmgmt/v1/addon_type_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,10 @@ func writeAddon(object *Addon, stream *jsoniter.Stream) {
stream.WriteMore()
}
stream.WriteObjectField("parameters")
writeAddonParameters(object.parameters, stream)
stream.WriteObjectStart()
stream.WriteObjectField("items")
writeAddonParameterList(object.parameters.items, stream)
stream.WriteObjectEnd()
count++
}
present_ = object.bitmap_&1048576 != 0 && object.requirements != nil
Expand Down Expand Up @@ -429,7 +432,24 @@ func readAddon(iterator *jsoniter.Iterator) *Addon {
object.operatorName = value
object.bitmap_ |= 262144
case "parameters":
value := readAddonParameters(iterator)
value := &AddonParameterList{}
for {
field := iterator.ReadObject()
if field == "" {
break
}
switch field {
case "kind":
text := iterator.ReadString()
value.link = text == AddonParameterListLinkKind
case "href":
value.href = iterator.ReadString()
case "items":
value.items = readAddonParameterList(iterator)
default:
iterator.ReadAny()
}
}
object.parameters = value
object.bitmap_ |= 524288
case "requirements":
Expand Down
Loading