Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
540 changes: 540 additions & 0 deletions clientapi/arohcp/v1alpha1/add_on_builder.go

Large diffs are not rendered by default.

162 changes: 162 additions & 0 deletions clientapi/arohcp/v1alpha1/add_on_config_builder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/*
Copyright (c) 2020 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// IMPORTANT: This file has been generated automatically, refrain from modifying it manually as all
// your changes will be lost when the file is generated again.

package v1alpha1 // github.com/openshift-online/ocm-api-model/clientapi/arohcp/v1alpha1

// Representation of an add-on config.
// The attributes under it are to be used by the addon once its installed in the cluster.
type AddOnConfigBuilder struct {
fieldSet_ []bool
id string
href string
addOnEnvironmentVariables []*AddOnEnvironmentVariableBuilder
secretPropagations []*AddOnSecretPropagationBuilder
}

// NewAddOnConfig creates a new builder of 'add_on_config' objects.
func NewAddOnConfig() *AddOnConfigBuilder {
return &AddOnConfigBuilder{
fieldSet_: make([]bool, 5),
}
}

// Link sets the flag that indicates if this is a link.
func (b *AddOnConfigBuilder) Link(value bool) *AddOnConfigBuilder {
if len(b.fieldSet_) == 0 {
b.fieldSet_ = make([]bool, 5)
}
b.fieldSet_[0] = true
return b
}

// ID sets the identifier of the object.
func (b *AddOnConfigBuilder) ID(value string) *AddOnConfigBuilder {
if len(b.fieldSet_) == 0 {
b.fieldSet_ = make([]bool, 5)
}
b.id = value
b.fieldSet_[1] = true
return b
}

// HREF sets the link to the object.
func (b *AddOnConfigBuilder) HREF(value string) *AddOnConfigBuilder {
if len(b.fieldSet_) == 0 {
b.fieldSet_ = make([]bool, 5)
}
b.href = value
b.fieldSet_[2] = true
return b
}

// Empty returns true if the builder is empty, i.e. no attribute has a value.
func (b *AddOnConfigBuilder) Empty() bool {
if b == nil || len(b.fieldSet_) == 0 {
return true
}
// Check all fields except the link flag (index 0)
for i := 1; i < len(b.fieldSet_); i++ {
if b.fieldSet_[i] {
return false
}
}
return true
}

// AddOnEnvironmentVariables sets the value of the 'add_on_environment_variables' attribute to the given values.
func (b *AddOnConfigBuilder) AddOnEnvironmentVariables(values ...*AddOnEnvironmentVariableBuilder) *AddOnConfigBuilder {
if len(b.fieldSet_) == 0 {
b.fieldSet_ = make([]bool, 5)
}
b.addOnEnvironmentVariables = make([]*AddOnEnvironmentVariableBuilder, len(values))
copy(b.addOnEnvironmentVariables, values)
b.fieldSet_[3] = true
return b
}

// SecretPropagations sets the value of the 'secret_propagations' attribute to the given values.
func (b *AddOnConfigBuilder) SecretPropagations(values ...*AddOnSecretPropagationBuilder) *AddOnConfigBuilder {
if len(b.fieldSet_) == 0 {
b.fieldSet_ = make([]bool, 5)
}
b.secretPropagations = make([]*AddOnSecretPropagationBuilder, len(values))
copy(b.secretPropagations, values)
b.fieldSet_[4] = true
return b
}

// Copy copies the attributes of the given object into this builder, discarding any previous values.
func (b *AddOnConfigBuilder) Copy(object *AddOnConfig) *AddOnConfigBuilder {
if object == nil {
return b
}
if len(object.fieldSet_) > 0 {
b.fieldSet_ = make([]bool, len(object.fieldSet_))
copy(b.fieldSet_, object.fieldSet_)
}
b.id = object.id
b.href = object.href
if object.addOnEnvironmentVariables != nil {
b.addOnEnvironmentVariables = make([]*AddOnEnvironmentVariableBuilder, len(object.addOnEnvironmentVariables))
for i, v := range object.addOnEnvironmentVariables {
b.addOnEnvironmentVariables[i] = NewAddOnEnvironmentVariable().Copy(v)
}
} else {
b.addOnEnvironmentVariables = nil
}
if object.secretPropagations != nil {
b.secretPropagations = make([]*AddOnSecretPropagationBuilder, len(object.secretPropagations))
for i, v := range object.secretPropagations {
b.secretPropagations[i] = NewAddOnSecretPropagation().Copy(v)
}
} else {
b.secretPropagations = nil
}
return b
}

// Build creates a 'add_on_config' object using the configuration stored in the builder.
func (b *AddOnConfigBuilder) Build() (object *AddOnConfig, err error) {
object = new(AddOnConfig)
object.id = b.id
object.href = b.href
if len(b.fieldSet_) > 0 {
object.fieldSet_ = make([]bool, len(b.fieldSet_))
copy(object.fieldSet_, b.fieldSet_)
}
if b.addOnEnvironmentVariables != nil {
object.addOnEnvironmentVariables = make([]*AddOnEnvironmentVariable, len(b.addOnEnvironmentVariables))
for i, v := range b.addOnEnvironmentVariables {
object.addOnEnvironmentVariables[i], err = v.Build()
if err != nil {
return
}
}
}
if b.secretPropagations != nil {
object.secretPropagations = make([]*AddOnSecretPropagation, len(b.secretPropagations))
for i, v := range b.secretPropagations {
object.secretPropagations[i], err = v.Build()
if err != nil {
return
}
}
}
return
}
71 changes: 71 additions & 0 deletions clientapi/arohcp/v1alpha1/add_on_config_list_builder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
Copyright (c) 2020 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// IMPORTANT: This file has been generated automatically, refrain from modifying it manually as all
// your changes will be lost when the file is generated again.

package v1alpha1 // github.com/openshift-online/ocm-api-model/clientapi/arohcp/v1alpha1

// AddOnConfigListBuilder contains the data and logic needed to build
// 'add_on_config' objects.
type AddOnConfigListBuilder struct {
items []*AddOnConfigBuilder
}

// NewAddOnConfigList creates a new builder of 'add_on_config' objects.
func NewAddOnConfigList() *AddOnConfigListBuilder {
return new(AddOnConfigListBuilder)
}

// Items sets the items of the list.
func (b *AddOnConfigListBuilder) Items(values ...*AddOnConfigBuilder) *AddOnConfigListBuilder {
b.items = make([]*AddOnConfigBuilder, len(values))
copy(b.items, values)
return b
}

// Empty returns true if the list is empty.
func (b *AddOnConfigListBuilder) Empty() bool {
return b == nil || len(b.items) == 0
}

// Copy copies the items of the given list into this builder, discarding any previous items.
func (b *AddOnConfigListBuilder) Copy(list *AddOnConfigList) *AddOnConfigListBuilder {
if list == nil || list.items == nil {
b.items = nil
} else {
b.items = make([]*AddOnConfigBuilder, len(list.items))
for i, v := range list.items {
b.items[i] = NewAddOnConfig().Copy(v)
}
}
return b
}

// Build creates a list of 'add_on_config' objects using the
// configuration stored in the builder.
func (b *AddOnConfigListBuilder) Build() (list *AddOnConfigList, err error) {
items := make([]*AddOnConfig, len(b.items))
for i, item := range b.items {
items[i], err = item.Build()
if err != nil {
return
}
}
list = new(AddOnConfigList)
list.items = items
return
}
75 changes: 75 additions & 0 deletions clientapi/arohcp/v1alpha1/add_on_config_list_type_json.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
Copyright (c) 2020 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// IMPORTANT: This file has been generated automatically, refrain from modifying it manually as all
// your changes will be lost when the file is generated again.

package v1alpha1 // github.com/openshift-online/ocm-api-model/clientapi/arohcp/v1alpha1

import (
"io"

jsoniter "github.com/json-iterator/go"
"github.com/openshift-online/ocm-api-model/clientapi/helpers"
)

// MarshalAddOnConfigList writes a list of values of the 'add_on_config' type to
// the given writer.
func MarshalAddOnConfigList(list []*AddOnConfig, writer io.Writer) error {
stream := helpers.NewStream(writer)
WriteAddOnConfigList(list, stream)
err := stream.Flush()
if err != nil {
return err
}
return stream.Error
}

// WriteAddOnConfigList writes a list of value of the 'add_on_config' type to
// the given stream.
func WriteAddOnConfigList(list []*AddOnConfig, stream *jsoniter.Stream) {
stream.WriteArrayStart()
for i, value := range list {
if i > 0 {
stream.WriteMore()
}
WriteAddOnConfig(value, stream)
}
stream.WriteArrayEnd()
}

// UnmarshalAddOnConfigList reads a list of values of the 'add_on_config' type
// from the given source, which can be a slice of bytes, a string or a reader.
func UnmarshalAddOnConfigList(source interface{}) (items []*AddOnConfig, err error) {
iterator, err := helpers.NewIterator(source)
if err != nil {
return
}
items = ReadAddOnConfigList(iterator)
err = iterator.Error
return
}

// ReadAddOnConfigList reads list of values of the ”add_on_config' type from
// the given iterator.
func ReadAddOnConfigList(iterator *jsoniter.Iterator) []*AddOnConfig {
list := []*AddOnConfig{}
for iterator.ReadArray() {
item := ReadAddOnConfig(iterator)
list = append(list, item)
}
return list
}
Loading